import { axios } from '@/utils/request'

const api = {
  sysClasses: '/system/classes'
}

export function getTreeForGreadDept(parameter) {
  return axios({
    url: api.sysClasses + '/treeForGreadDept',
    method: 'get',
    params: parameter
  })
}

export function getSysClassesList (parameter) {
  return axios({
    url: api.sysClasses + '/list',
    method: 'get',
    params: parameter
  })
}

export function getClassesList (parameter) {
  return axios({
    url: api.sysClasses + '/jlist',
    method: 'get',
    params: parameter
  })
}

export function saveSysClasses (parameter) {
  return axios({
    url: api.sysClasses + (parameter.classesId > 0 ? '/update' : '/save'),
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function delSysClasses (parameter) {
  return axios({
    url: api.sysClasses + '/remove',
    method: 'post',
    params: parameter
  })
}

export const sysClassesExport = api.sysClasses + '/export'
